import React from 'react'
import { Routes, Route, Link } from 'react-router-dom'
import Home from './pages/Home'
import Login from './pages/Login'
import Test from './pages/Test'
// 需求: Home和Login是两个一级路由组件, Test是Home里面的二级路由组件.Test渲染在Home组件中hr下面
export default function App() {
  return (
    <div>
      {/* Link默认是添加历史记录,写了replace则变成替换历史记录 */}
      <Link to="/home" replace>
        home
      </Link>
      <Link to="/login">login</Link>
      <hr />
      <Routes>
        <Route path="home" element={<Home></Home>}>
          <Route path="test" element={<Test></Test>}></Route>
        </Route>
        <Route path="login" element={<Login></Login>}></Route>
      </Routes>
    </div>
  )
}
